
public class algs04 {
	public static int searchT(int x){
		int T = 0;
		for(int N = 1; N < x; N=N*10){
			T++;
		}
		return T;
	}
	public static int xtn(int x,int n){
		int a = x;
		for(int iter = 1; iter < n; iter++)
			a = a * x;
		return a;
	}
	public static void main(String[] args) {
		int a = 2222;
		int b = 1111;
		int n = searchT(a);
		int m = n/2;
		int i;
		int a0,a1,b0,b1;
		a0 = a;
		b0 = b;
		for(i = 0;i < m;i++)
		{
			a0 = a0 / 10;
			b0 = b0 / 10;
		}
		a1 = a - a0* xtn(10,m);
		b1 = b - b0* xtn(10,m);
		System.out.println(a1);
		System.out.println(a0);
		System.out.println(b1);
		System.out.println(b0);
		int mult = a0*b0 +(a0*b1 + a1*b0)* (xtn(10,m)) + a1*b1*(xtn(10,(2*m)));
		System.out.println(mult);
			

	}

}
